﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MensUnoShop.Models.ViewModels.OrderViewModel>" %>
<%@ Import Namespace="MensUnoShop.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	men'suno SHOP
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%
    var ismaga = false;
    if (Model.OD.MLIST.Any(m => m.TYPE == Config.MarketType.Mangazine))
        ismaga = true;
%>

<div class="CART_CONTENT">
<img src="/Content/page_img/cart_content_top.gif" />
<div class="CART_TITLE">
<h1 class="TITLE_CASHIER">結帳櫃檯</h1>
<span class="FAVORITE_BT_CART"><a href="/market/c">檢視購物車</a></span>
<br class="CLEAR" />
</div>
<div class="CART_FORM">
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="114"><div align="center"></div></td>
      <td width="97"><div align="center"></div></td>
      <td width="394"><div align="left">商品<br />
        Item </div></td>
      <td width="62"><div align="center"><%if(ismaga){ %>期數<br />issues<%}else{ %>顏色<br />Color<%} %></div></td>
      <td width="62"><div align="center"> 單價<br />
        Price </div></td>
      <td width="53"><div align="center"> 數量<br />
        Quantity
      </div></td>
      <td width="130"><div align="center">金額小計<br />
        Total price</div></td>
    </tr>
  <% foreach (var sc in Model.OD.MLIST.Where(m => m.TYPE != Config.MarketType.Combo))
     {%>
  <tr>
    <td><div align="center"></div></td>
    <td><div align="center"><img src="<%:sc.IMG %>" width="75" height="75" /></div></td>
    <td valign="top"><%:sc.SN %><br /><%:sc.TITLE %><br />
      <span class="PRODUCT3_HOT_POINT"><%:sc.DISCOUNTNOTE %></span></td>
    <td><div align="center"><%:sc.COLOR %></div></td>
    <td><div align="center">NT$<%:sc.SINGLEPRICE %></div></td>
    <td><div align="center"><%:sc.AMOUNT%></div></td>
    <td><div align="center">NT$<%:sc.PRICE %></div></td>
    <td><div align="center"></div></td>
  </tr>
  <%} %>
  <% foreach(var sc in Model.OD.MLIST.Where(m=>m.TYPE==Config.MarketType.Combo).GroupBy(m=>m.COMBOID)){
         int i = 0;
         int pices = sc.Count();
         int divv = pices / sc.FirstOrDefault(s => s.AMOUNT > 0).AMOUNT;
         foreach (var s in sc)
         {
             string cs = string.Empty;
             string cs1 = string.Empty;
             string single = string.Empty;
             string amount = string.Empty;
             string total = string.Empty;

             if (i != sc.Count() - 1)
             {
                 cs = "style=\"border-bottom:none;\"";
                 cs1 = "style=\"border-bottom:none;\"";
             }
             if ((i + 1) % divv == 0)
             {
                 cs = "style=\"border-bottom:none;\"";
                 cs1 = string.Empty;
             }
             
             if (i == 0)
             {
                 single = "NT$"+s.SINGLEPRICE.ToString();
                 amount = s.AMOUNT.ToString();
                 total = "NT$"+s.PRICE.ToString();
             }
             else
             {
                 single = string.Empty;
                 amount = string.Empty;
                 total = string.Empty;
             }
  %>
  <tr>
    <td <%=cs %>><div align="center"></div>
    </td>
    <td <%=cs1 %>><div align="center"><img src="<%:s.IMG %>" width="75" height="75" /></div></td>
    <td <%=cs1 %> valign="top"><%:s.SN%><br /><%:s.TITLE%><br />
      <span class="PRODUCT3_HOT_POINT"><%:s.DISCOUNTNOTE%></span></td>
    <td <%=cs1 %>><div align="center"><%:s.COLOR%></div></td>
    <td <%=cs %>><div align="center"><%:single%></div></td>
    <td <%=cs %>><div align="center"><%:amount%></div></td>
    <td <%=cs %>><div align="center"><%:total%></div></td>
    <td <%=cs %>><div align="center"></div></td>
  </tr>
  <%
             i++;
         }
     } %>
 
</table>
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
<%foreach (var d in Model.OD.DSKLIST)
    { %>
  <tr>
    <td width="115"></td>
    <td width="605"><%:d.TITLE %></td>
    <td width="130" align="center">- NT$<%:d.DEPRICE%> </td>
  </tr>
  <%} %>
  <tr>
    <td width="115" class="FONT_GREEN"><div align="right">運送方式Shipping</div></td>
    <td width="605">
        <%if (Model.OD.SHIPPINGWAY == 0 && !ismaga){%>台灣地區免運費Taiwan(郵局掛號、存局候領、超商取貨)<%} %>
        <%else{%>
            寄送地區僅限台灣及離島地區，海外購買請洽客服：886-2-27316690 ext.105或電郵至<a href="hung@chicgroup.com.tw">hung@chicgroup.com.tw</a>
        <%} %>
        <%if (Model.OD.SHIPPINGWAY == 1){%>亞洲地區Asia(EMS國際快捷)<%} %>
        <%if (Model.OD.SHIPPINGWAY == 2){%>美洲、歐洲地區America &amp; Europe(EMS國際快捷)<%} %>
        <%if (Model.OD.SHIPPINGWAY == 3){%>中美洲、非洲Central America &amp; Africa(EMS國際快捷)<%} %></td>
    <td width="130"><div align="center">NT$<%:Model.OD.DELIVERYCOST %></div></td>
  </tr>
  <tr>
    <td height="50" bgcolor="#CCCCCC">&nbsp;</td>
    <td height="50" bgcolor="#CCCCCC"><div align="right" class="FINAL_PRICE">金額總計Total</div></td>
    <td height="50" align="center" bgcolor="#CCCCCC" class="FINAL_PRICE">NT$<%:Model.OD.PAYPRICE %></td>
  </tr>
</table><form action="/order/pay2/<%:Model.OD.SCGUID %>" method="post"><input type="hidden" name="scck" value="<%:Model.SCCK %>" />
	<div class="BUYER_INFO">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="14%" valign="top" class="FONT_GREEN"><div align="right">付款方式Payment</div></td>
    <td width="86%">
    <div class="PAY">
    	<ul>
        <li><input name="payway" type="radio" value="1" checked />線上刷卡Pay by credit card online</li>
        <li><input name="payway" type="radio" value="5" /><img src="/Content/page_img/pay_ibon.jpg" />　<img src="/Content/page_img/pay_famiport.jpg" />　<img src="/Content/page_img/pay_life-et.jpg" /></li>      
         <li><input name="payway" type="radio" value="2" />ATM 轉帳 (自動櫃員機轉帳)Virtual account (Taiwan Only)</li>
         <li><input name="payway" type="radio" value="4" />超商代收(虛擬編號)-限台灣Payment on the convenient store(Taiwan Only)</li>
        <li><input name="payway" type="radio" value="3" />Web-ATM-限台灣Taiwan Only</li>
        <br class="CLEAR" />
    </div>
    
     
    
    
    </td>
  </tr>
</table>
<div class="CART_BOTTOM_BT">
 <input type="button"  value="取消付款 Cancel" onclick="location.href='/'" />

      <input type="submit" value="確認付款 Check" />
 　     
    </div>
	</div>
    </form>
</div>
<br class="CLEAR" />
<img src="/Content/page_img/cart_content_bottom.gif" /></div>
</asp:Content>
